<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>医师管理</title>
  <link rel="stylesheet" href="../../static/bootstrap/css/bootstrap.min.css" />
  <link rel="stylesheet" href="../../static/css/global.css" />
  <!-- <link rel="stylesheet" href="../../static/css/admin.css" /> -->
</head>

<body>
  <main class="mainBox" th:fragment="doctorManage">
    <div class="container shadow-md-sm">
      <header class="row">
        <div class="col-12 col-md-2 mb-4">
          <button type="button" class="btn btn-outline-success w-100">
            <a href="/admin/doctorManage/addDoctor"> 新增医师</a>
          </button>
        </div>
        <form class="col-12 col-md-5" action="/admin/doctorManage" method="get">
          <div class="input-group mb-4 z-0">
            <select id="section" class="form-select" name="section">
              <option class="text-warning" value="null" selected>
                所属科室
              </option>
              <option th:each="section: ${filter.sectionList}" th:text="${section}" th:value="${section}">
                One
              </option>
            </select>
            <select id="position" class="form-select" name="position">
              <option class="text-warning" value="null" selected>
                医师职称
              </option>
              <option th:each="position: ${filter.positionList}" th:text="${position}" th:value="${position}">
                One
              </option>
            </select>
            <button class="btn btn-outline-secondary" type="submit" onclick="">
              筛选
            </button>
          </div>
        </form>
        <form class="col-12 col-md-5" action="/admin/doctorManage" method="get">
          <div class="input-group mb-4 z-0">
            <input type="text" class="form-control" placeholder="请输入医师相关信息，例如姓名、性别、身份证号等" name="fuzzyQuery" />
            <button class="btn btn-outline-secondary" type="submit">
              查询医师
            </button>
          </div>
        </form>
      </header>
      <div class="table-responsive-xxl">
        <table class="table table-striped align-middle">
          <thead>
            <tr>
              <th scope="col">编号</th>
              <th scope="col">姓名</th>
              <th scope="col">性别</th>
              <th scope="col">出生日期</th>
              <th scope="col">所属科室</th>
              <th scope="col">所任职位</th>
              <th scope="col">电子邮箱</th>
              <th scope="col">手机号码</th>
              <th scope="col">身份证号</th>
              <th scope="col">操作</th>
            </tr>
          </thead>
          <tbody id="doctorList">
            <tr th:each="doctor: ${doctorList}">
              <th scope="row" th:text="${doctor.id}">1</th>
              <td th:text="${doctor.name}">Mark</td>
              <td th:text="${doctor.sex}">Otto</td>
              <td th:text="${doctor.birthday}">@mdo</td>
              <td th:text="${doctor.section}">Mark</td>
              <td th:text="${doctor.position}">Mark</td>
              <td th:text="${doctor.email}">Mark</td>
              <td th:text="${doctor.phone}">Otto</td>
              <td th:text="${doctor.idcard}">@mdo</td>
              <td th:switch="${doctor.status}" id="opreation">
                <button class="btn btn-outline-success btn-sm">
                  <a th:href="@{/admin/doctorManage/addDoctor(id=${doctor.id})}">
                    更新
                  </a>
                </button>
                <button th:case="true" class="btn btn-outline-warning btn-sm" onclick="blockUser(doctor.id)">
                  <a th:href="@{/admin/doctorManage/blockOpreation(id=${doctor.id},status=false)}">
                    冻结
                  </a>
                </button>
                <button th:case="false" class="btn btn-outline-success btn-sm">
                  <a th:href="@{/admin/doctorManage/blockOpreation(id=${doctor.id},status=true)}">
                    解封
                  </a>
                </button>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </main>
  <script src="../../static/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  <script th:inline="javascript">
    var blockUser = (id) => {
      console.log(id);
    };
  </script>
</body>

</html>